{extend name="public:base" /}

{block name="content"}
<div class="page-header">
	<h1>	
		{$breadcrumb1}
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$breadcrumb2}
		</small>
	</h1>
</div>	
<div class="page-header">
	<a href="{:url('Field/add')}" class="btn btn-primary">新增</a>
</div>		
	
<table class="table table-striped table-bordered table-hover search-form">
	<thead>
		<th><input name="name" type="text" placeholder="输入配置名称" value="{:input('name')}" /></th>
		<th>    				
			<select name="code">
				<option value="">-所有分组-</option>
				
				{volist name="payment_code" id="code"}
					<option {if condition="$Request.param.code eq $code['code']"} selected="selected"{/if} value="{$code.code}">{$code.code}</option>
				{/volist}
				
				
			</select>
		</th>
		<th>
			<a class="btn btn-primary" href="javascript:;" id="search" url="{:url('Field/index')}">查询</a>
		</th>
	</thead>
</table>	
	
<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>											
						<th>名称</th>
						<th>支付方式</th> 
						<th>code</th> 
						<th>值</th>  		
						<th>描述</th>  	
						<th>排序</th>  			
						<th>操作</th>				
					</tr>
				</thead>
				<tbody>
						{volist name="list" id="c" empty="$empty"}
						<tr>							
							<td>{$c.name}</td>
							<td>{$c.payment_name}</td>
							<td>{$c.payment_code}</td>
							<td>{$c.value}</td>		
							<td>{$c.info}</td>		
							<td>{$c.sort_order}</td>
							<td>
								<a  class="btn btn-xs btn-info" href='{:url("Field/edit",array("id"=>$c["id"]))}'>
									<i class="fa fa-edit bigger-120"></i>
								</a> 
								<a class="delete btn btn-xs btn-danger" href='{:url("Field/del",array("id"=>$c["id"]))}' >
									<i class="fa fa-trash bigger-120"></i>
								</a>
							</td>
						</tr>
						{/volist}	
						
						<tr>
							<td colspan="20" class="page">{$list->render()}</td>
						</tr>
						<tr>
							<td colspan="20">总计 {$list->total()|default="0"} 个配置</td>
						</tr>
				</tbody>
				
			</table>
		</div>
	</div>
</div>
{/block}
{block name="javascript"}
<script>
$(function(){
	
	$("#search").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });
	
	
});		
</script>
{/block}